libxl: slightly refine pci-assignable-{add, remove} handling
authorJan Beulich <JBeulich@suse.com>
Thu, 10 Sep 2015 12:36:54 +0000 (06:36 -0600)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 15 Sep 2015 10:58:26 +0000 (11:58 +0100)
commit6e1e3480c3878bac5d244925974a6852c47c809b
tree3936a693c03d38e5eb53b559c76eeb126c9ac460
parent486252f8a86bca36c7c737a25d95327def7a1af3
libxl: slightly refine pci-assignable-{add, remove} handling

While it appears to be intentional for "xl pci-assignable-remove" to
not re-bind the original driver by default (requires the -r option),
permanently losing the information which driver was originally used
seems bad. Make "add; remove; add; remove -r" re-bind the original
driver by allowing "remove" to delete the information only upon
successful re-bind.

In the course of this I also noticed that binding information is lost
when upon first "add" pciback isn't loaded yet, due to its presence not
being checked for early enough. Adjust pciback_dev_is_assigned()
accordingly, and properly distinguish "yes" and "error" returns in the
"add" case (removing a redundant error message from the "remove" path
for consistency).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxl/libxl_pci.c